<template>
	<!-- 添加弹框 -->
	<el-dialog  width="1000px" visible :show-close="false" closeOnClickModal  :append-to-body="true" class="wrap" @close="cancel" :close-on-click-modal="false">
		<i class="el-icon-close close" @click="cancel" style="color: white;"></i>
	    <div class="bt">基础设置</div>
			<div class="htsz">
				
			<div class="top" v-if="this.qxbtn.c030x">
			<div class="tp" @click="qxsz()"  style="background:#E6A23C;color: white;"><i class="el-icon-date" style="margin: 10px 0;font-size:30px;"></i><br><span style="font-size:16px ;">职位权限</span></div>
			</div>	
			
			<div class="top" v-if="this.qxbtn.c031x">
			<router-link to="/admin/person"  >
			<div class="tp"  style="background:#FF6897;color: white;"><i class="el-icon-setting" style="margin: 10px 0;font-size:30px;"></i><br><span style="font-size:16px ;">人事设置</span></div>
			</router-link>
			</div>
				
			<div class="top" v-if="this.qxbtn.c032x">
			<router-link to="/admin/jiaoshi" >
			<div class="tp" style="background:#67C23A;color: white;"><i class="el-icon-menu" style="margin: 10px 0;font-size:30px;"></i><br><span style="font-size:16px ;">教室设置</span></div>
			</router-link>
			</div>	
			
			<div class="top" v-if="this.qxbtn.c033x">
			<router-link to="/admin/holidays"  >
			<div class="tp"  style="background:#E6A23C;color: white;"><i class="el-icon-date" style="margin: 10px 0;font-size:30px;"></i><br><span style="font-size:16px ;">节假日设置</span></div>
			</router-link>
			</div>
			
			<div class="top" v-if="this.qxbtn.c034x">
		    <router-link :to="{path:'/admin/bqy',query: {frompage:'xsadd'}}">
			<div class="tp" style="background:#1DD3C3;color: white;"><i class="el-icon-star-off" style="margin: 10px 0;font-size:30px;"></i><br><span style="font-size:16px ;">学生标签设置</span></div>
			</router-link>
			</div>
			
			<div class="top" v-if="this.qxbtn.c035x">
			<router-link to="/admin/xxjbsz"  >
			<div class="tp" style="background:#FA5555;color: white;"><i class="el-icon-setting" style="margin: 10px 0;font-size:30px;"></i><br><span style="font-size:16px ;">学校信息设置</span></div>
			</router-link>
			</div>
			
			<div class="top" v-if="this.qxbtn.c036x">
			<router-link to="/admin/xtcs" >
			<div class="tp" style="background:#409EFF;color: white;"><i class="el-icon-view" style="margin: 10px 0;font-size:30px;"></i><br><span style="font-size:16px ;">基础参数设置</span></div>
			</router-link>
			</div>
			
			<div class="top" v-if="this.qxbtn.c066x">
			<router-link to="/admin/xtpz"  >
			<div class="tp"  style="background:#F56C6C;color: white;"><i class="el-icon-setting" style="margin: 10px 0;font-size:30px;"></i><br><span style="font-size:16px ;">系统配置</span></div>
			</router-link>
			</div>
			
			<!--<div class="top" v-if="this.qxbtn.c037x">
			<router-link to="/admin/infomode"  >
			<div class="tp"  style="background:#E6A23C;color: white;"><i class="el-icon-date" style="margin: 10px 0;font-size:30px;"></i><br><span style="font-size:16px ;">系统消息模板</span></div>
			</router-link>
			</div>-->
			
			<div class="top" v-if="this.qxbtn.c037x">
			<router-link to="/manage/wpfx" >
		    <div class="tp"  style="background:#EB9E05;color: white;"><i class="el-icon-search" style="margin: 10px 0;font-size:30px;"></i><br><span style="font-size:16px ;">物品价格设置</span></div>
			</router-link>
			</div>

			<div class="top" v-if="this.qxbtn.c038x">
			<router-link to="/educa/fxkc"  >
			<div class="tp"  style="background:#67C23A;color: white;"><i class="el-icon-share" style="margin: 10px 0;font-size:30px;"></i><br><span style="font-size:16px ;">课程价格设置</span></div>
			</router-link>
			</div>
			
			<div class="top" v-if="this.qxbtn.c067x">
			<router-link to="/admin/infomode">
				<div class="tp" style="background:#168CF8;color: white;"><i class="el-icon-circle-plus-outline" style="margin: 10px 0;font-size:30px;"></i><br><span style="font-size:16px ;">通知信息模板</span></div>
			</router-link>
			</div>
			
			
			<!--<div class="top">
			<div class="tp" @click="componentsShow('xxdy')" style="background:#67C23A;color: white;"><i class="el-icon-share" style="margin: 10px 0;font-size:30px;"></i><br><span style="font-size:16px ;">消息订阅</span></div>
			</div>-->

			</div>
			<div v-if='aa' style="width: 100%;text-align: center;color: red;font-size: 20px;">您没有权限操作该模块里的功能！</div>
		<PayArticle class="wpfl1" @jcarticle="jcarticleed"  @close="jcarticlecancel" v-if="showarticle"></PayArticle>
		<Kschoose class="wpfl" @wpchoose="wpchooseed" @close="wpchoosecancel" v-if="showchoselist"></Kschoose>
		    <qxszComponent v-if="qxsz1"  @close="qxsz2"  :params="111"></qxszComponent>
		<XxdyComponent v-if="portComponents.xxdy.toggle" @close="componentsHide" :params="portComponents.xxdy.params" ></XxdyComponent>
		    
		
	</el-dialog>
</template>
<script type="text/javascript">
	import Kschoose from '../../manage/kssz/kschoose'
	import qxszComponent from '@/view/admin/personManage/ryqxsz'
	import PayArticle from './pay-articlejc'
	import XxdyComponent from './xxdy'
	import qs from 'qs'
	export default {
		components: { Kschoose, PayArticle,qxszComponent ,XxdyComponent},
		data() {
			return {
				aa:true,
				//查看权限
				qxsz1:false,
				qxbtn:{
					c030x:false,
					c031x:false,
					c032x:false,
					c033x:false,
					c034x:false,
					c035x:false,
					c036x:false,
					c037x:false,
					c038x:false,
					c066x:false,
					c067x:false,
				},
				showchoselist: false,
				showarticle: false,
				vfxkcid: '',
				vfxkcidmc: '',
				vmc: '',
				vbtime:'',
				vlsid: '',
				vcid: '',
				vjcid: '',
				vjcidmc: '',
				vlx: '',
				vypks: '',
				xzls:'',
				comboxlist: [],
				dialogTableVisible: true,
				xzlsList: [],
				/*组件区域*/
				portComponents: {
					xxdy: {
						type: 'xxdy',
						toggle: false,
						params: '',
						data: {}
					},
				},
			}
		},
		created() {
			     //权限
				 var logininfo = JSON.parse(localStorage.logininfo) ;
				 this.qxbtn.c030x = (logininfo.auth.indexOf("c030x")!=-1);
                 this.qxbtn.c031x = (logininfo.auth.indexOf("c031x")!=-1);
                 this.qxbtn.c032x = (logininfo.auth.indexOf("c032x")!=-1);
                 this.qxbtn.c033x = (logininfo.auth.indexOf("c033x")!=-1);
                 this.qxbtn.c034x = (logininfo.auth.indexOf("c034x")!=-1);
                 this.qxbtn.c035x = (logininfo.auth.indexOf("c035x")!=-1);
                 this.qxbtn.c036x = (logininfo.auth.indexOf("c036x")!=-1);
                 this.qxbtn.c037x = (logininfo.auth.indexOf("c037x")!=-1);
                 this.qxbtn.c038x = (logininfo.auth.indexOf("c038x")!=-1);
                 this.qxbtn.c066x = (logininfo.auth.indexOf("c066x")!=-1);
                 this.qxbtn.c067x = (logininfo.auth.indexOf("c067x")!=-1);
                 if(logininfo.auth.indexOf("c030x")!=-1){
                 	this.aa=false;
                 }
                 else if(logininfo.auth.indexOf("c031x")!=-1){
                 	this.aa=false;
                 }
                 else if(logininfo.auth.indexOf("c032x")!=-1){
                 	this.aa=false;
                 }
                 else if(logininfo.auth.indexOf("c033x")!=-1){
                 	this.aa=false;
                 }
                 else if(logininfo.auth.indexOf("c034x")!=-1){
                 	this.aa=false;
                 }
                 else if(logininfo.auth.indexOf("c035x")!=-1){
                 	this.aa=false;
                 }
                 else if(logininfo.auth.indexOf("c036x")!=-1){
                 	this.aa=false;
                 }
                 else if(logininfo.auth.indexOf("c037x")!=-1){
                 	this.aa=false;
                 }
                 else if(logininfo.auth.indexOf("c038x")!=-1){
                 	this.aa=false;
                 }
                 else if(logininfo.auth.indexOf("c066x")!=-1){
                 	this.aa=false;
                 }
                 else if(logininfo.auth.indexOf("c067x")!=-1){
                 	this.aa=false;
                 }
			this.getcomboxlist();
			this.getxzlsList();
		},
		methods: {
			qxsz(){
				this.qxsz1=true
			},
			qxsz2(){
				this.qxsz1=false
			},
			getxzlsList () {
				var logininfo = JSON.parse(localStorage.logininfo);
					this.axios.get( this.$store.state.api + 'ls/xzxzls', {
							params: {
								yhid: logininfo.id,
								xxid:logininfo.xxid
							}
					})
					.then( res => {
							console.log(res)
							this.xzlsList = res.data.data;
					}).catch( res => {
							console.log(res)
					})
			},
			submit() {
				//检测
				this.$store.state.loading = true;
				if(!this.vfxkcid) {
					this.$message.warning('请选择分校课程');
					this.$store.state.loading = false;
					return;
				}
				var time1 = this.$.getLocalTimeNo0(Date.parse(this.vbtime));
				var logininfo = JSON.parse(localStorage.logininfo);
				var params3 = qs.stringify({
					xzid:this.xzls,
					fxkcid: this.vfxkcid,
					mc: this.vmc,
					lsid: this.vlsid,
					cid: this.vcid,
					jcid: this.vjcid,
					lx: 'cj',
					ypks: '0',
					yhid: logininfo.id,
					xxid: logininfo.xxid,
					kbrq:time1
				});
				//执行
				this.axios.post(this.$store.state.api + 'bj/insert', params3)
					.then(res => {
						if(res.data.code == 1) {
							this.$emit('close', { type: 'jcsz', cancel: false });
							this.$store.state.loading = false;
						} else {
						this.$message.warning(res.data.msg);
							this.$store.state.loading = false;
						}
					}).catch(res => {
						this.$message.warning("服务器繁忙，请重试");
						this.$store.state.loading = false;
					})
			},
			showwp() {
				this.showchoselist = true;
			},
			showjc() {
				this.showarticle = true;
			},
			wpchooseed(josndata) {
				this.vfxkcidmc = josndata.kcmc;
				this.vfxkcid = josndata.fxkcid;

				this.showchoselist = false;
			},
			jcarticleed(josndata) {
			    this.vcid = josndata.cid;
			    this.vjcid = josndata.jcid;
			    this.vjcidmc = josndata.jcidmc;
				this.showarticle = false;
			},
			wpchoosecancel() {
				this.showchoselist = false;
			},
			jcarticlecancel() {
				this.showarticle = false;
			},
			cancel() {
				this.$emit('close', { type: 'jcsz', cancel: true })
			},
			getcomboxlist() {
				var logininfo = JSON.parse(localStorage.logininfo);
				this.searchLoading = true;
				this.axios.get(this.$store.state.api + 'ls/getlslist', {
					params: {
						yhid: logininfo.id,
						xxid: logininfo.xxid
					}
				}).then(res => {
					console.log(res)
					let data = res.data.data;
					let list = data.list;
					this.comboxlist = list;
					console.log(this.comboxlist)
				}).catch(res => {
					console.log(res)
					this.searchLoading = false;
				})
			},
			/* 组件的弹框  */
			componentsShow(type, data) { //显示组件
				for(let i in this.portComponents) {
					if(type == this.portComponents[i].type) {
						this.portComponents[i].toggle = true;
						this.portComponents[i].params = data;
						if(this.portComponents[i].data.type == 'single') {
							this.portComponents[i].data.index = data.row.id
						} else if(this.portComponents[i].data.type == 'multiple') {
							this.portComponents[i].data.index = this.multipleDelNum;
						} else {
							return;
						}
						return;
					}
				}
			},
			componentsHide(setting) { //关闭组件
				this.portComponents.xxdy.toggle=false;
				for(let i in this.portComponents) {
					if(setting.type == this.portComponents[i].type) {
						this.portComponents[i].toggle = false;
						if(!setting.cancel) {
							this.search();
						}
						return;
					}
				}
			},
		}
	}
</script>
<style lang="less" scoped >
	.wrap {
		.row{
			height:50px;
			line-height: 50px;
		}
		.bt{
			position: absolute;
			width: 100%;
			height: 50px;
			margin: 0 auto;
			top: 0;
			left: 0;
			// margin-top: -70px;
			background: #50BFFF;
			// margin-left: -20px;
			// margin-bottom: 20px;
			color:white;
			text-align:left;
			line-height: 50px;
			font-size: 17px;
			padding-left: 15px;
		}
	.close{
			    top: 10px;
			    font-size: 25px;
				z-index: 10;
				position: absolute;
		}
		.top{
			width: 140px;
		height: 80px;
		// float: left;
		border-radius: 8px;
		margin-right: 15px;
		margin-top: 20px;
		background: white;
		cursor: pointer;
		// position: absolute;
		box-shadow: 7px 7px 7px #B3B3B3;
		border-radius: 8px;
		}
		.top:hover{
			 transform:scale(1.1);
	        -ms-transform:scale(1.1);
	        -webkit-transform:scale(1.1);
	        -o-transform:scale(1.1);
	        -moz-transform:scale(1.1);
		}
		.tp {
		width: 100%;
		height: 80px;
		// float: left;
		border-radius: 8px;
		background: white;
		// position: absolute;
		box-shadow: 7px 7px 7px #B3B3B3;
		border-radius: 8px;
	}
		.htsz{
			display: flex;
			justify-content: space-around;
			flex-flow: wrap;
			width: 100%;
			height:100%;
			margin: 0 auto;
			margin-bottom: 25px;
			// float: left;
			/*margin-top: 52px;*/
	/*		margin-bottom: 10px;*/
			color: white;
			text-align: center;
			font-size: 16px;
	/*		background: white;*/
	/*		border-top: 3px solid deepskyblue;*/
		}
	}
</style>
